package com.shusiedu.utils;

import org.apache.poi.xwpf.usermodel.XWPFDocument;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;

public class WordUtil {
    public void exportWord(XWPFDocument document, HttpServletResponse response, String fileName) throws Exception{
        response.setHeader("Content-Disposition","attachment;fileName="+ fileName+".docx");
        response.setContentType("application/msword");
        OutputStream os = response.getOutputStream();
        document.write(os);
        os.flush();
        os.close();
    }

}